<script lang="ts" setup>
import { ref } from 'vue';
import AXIOS from "axios";
import axios from 'axios';
let ulname = ref("");
let ulpwd = ref("");
function AddLogin() {
    if (ulname.value == "" || ulpwd.value == "") {
        alert("用户名密码不能为空");
    }
    //提交数据
    AXIOS.post("https://localhost:44395/api/user/IAddLogin", {
        "UL_Name": ulname.value,
        "UL_PWD": ulpwd.value
    })
        .then(function (response) {
            console.log(response.data);
            // let datas = response.data;
            // alert(datas.U_Id);
            // alert(datas.UL_Name);
            // alert(datas.UL_PWD);
            // alert(datas.UL_DataTime);
            //跳转页面

        })
        .catch(function (err) {
            console.log(err.message);
        });
}

function DelData(o) {
    if(o==null || o==""){
        alert('参数错误');
        return;
    }

    axios.delete('api删除方法地址',
    {
        "uid":o
    })
    .then(function (response) {
        console.log(response .data);
    })
}
</script>


<template>
    <div>
        注册用户
        <div class="pure-u-1">
            <div class="main">
                <div class="panel panel-default">
                    <div class="panel-title">
                        注册用户
                    </div>
                    <div class="panel-body">

                        <fieldset>
                            <div class="pure-control-group">
                                <label for="name">用户名：</label>
                                <input id="name" class="pure-input-1-3" type="text" v-model="ulname" />
                            </div>
                            <div class="pure-control-group">
                                <label for="name">密码：</label>
                                <input id="name" class="pure-input-1-3" type="password" v-model="ulpwd" />
                            </div>
                            <div class="pure-controls">
                                <input class="pure-button pure-button-primary" type="button" name="submit" value="提交"
                                    @click="AddLogin()" />
                                
                                    <input type="button" value="删除" @click="DelData(item.uid)" />
                            </div>
                        </fieldset>

                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<style src="../assets/DomCss/css/pure-nr-min.css"></style>
<style src="../assets/DomCss/css/main.css"></style>
<style src="../assets/DomCss/css/admin.css"></style>
<style src="../assets/DomCss/css/fontAwesome/font-awesome.css"></style>